﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

namespace VTFC
{
    // ----------------------------------------------------------------------------
    /// <summary>
    /// About form.
    /// </summary>
    // ----------------------------------------------------------------------------
    partial class FrmAbout : Form
    {
        // ----------------------------------------------------------------------------
        /// <summary>
        /// Constructor.
        /// </summary>
        // ----------------------------------------------------------------------------
        public FrmAbout()
        {
            InitializeComponent();
            InitializeContent();
        }//ctor

        private void InitializeContent()
        {
            this.Text = Resources.FrmAbout_Text;
            this.labelProductName.Text = AssemblyProduct;
            this.labelVersion.Text = String.Format(Resources.FrmAbout_Version, AssemblyVersion);
            this.textBoxDescription.Text = AssemblyDescription;
        }//func InitializeContent

        #region Assembly Attribute Accessors

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Title of assembly.
        /// </summary>
        // ----------------------------------------------------------------------------
        public string AssemblyTitle
        {
            get
            {
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
                if (attributes.Length > 0)
                {
                    AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
                    if (titleAttribute.Title != "")
                    {
                        return titleAttribute.Title;
                    }
                }
                return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
            }
        }//prop AssemblyTitle

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Version of assembly.
        /// </summary>
        // ----------------------------------------------------------------------------
        public string AssemblyVersion
        {
            get
            {
                return BaseLogic.GetAssemblyVersion();
            }
        }//prop AssemblyVersion

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Description of current application.
        /// </summary>
        // ----------------------------------------------------------------------------
        public string AssemblyDescription
        {
            get
            {
                return Resources.AboutDescription;
            }
        }//prop AssemblyDescription

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Product full name.
        /// </summary>
        // ----------------------------------------------------------------------------
        public string AssemblyProduct
        {
            get
            {
                return Constant.VTFC_APPLICATION_FULL_NAME;
            }
        }//prop AssemblyProduct

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Copyright.
        /// </summary>
        // ----------------------------------------------------------------------------
        public string AssemblyCopyright
        {
            get
            {
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
                if (attributes.Length == 0)
                {
                    return "";
                }
                return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
            }
        }//prop AssemblyCopyright

        // ----------------------------------------------------------------------------
        /// <summary>
        /// Company name.
        /// </summary>
        // ----------------------------------------------------------------------------
        public string AssemblyCompany
        {
            get
            {
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
                if (attributes.Length == 0)
                {
                    return "";
                }
                return ((AssemblyCompanyAttribute)attributes[0]).Company;
            }
        }//prop AssemblyCompany
        #endregion
    }//class About
}//namespace VTFC
